#ifndef PARSE_H
#define PARSE_H

#include <vector>
#include <cstdlib>
#include <cstring>
#include <cstdio>
#include <unordered_map>
#include <string>

struct Statistics {
    std::unordered_map<int, int> varFrequency;  // Variable -> frequency count
    std::unordered_map<int, int> clauseLengths;  // Length -> count
    int numVariables;
    int numClauses;
    
    void printStats() const;
};

// Parse either a plain CNF file or an XZ compressed CNF file
Statistics parse(const char *filename);

// Internal helper functions
void parseCompressed(const char *filename);
void parsePlainText(const char *filename);
void parseFromMemory(char* data, Statistics& stats);

#endif 